package com.alibaba.algo.dao.user;

import com.alibaba.algo.cooperation.feign.vo.req.CheckUserPermissionsReqVO;
import com.alibaba.algo.cooperation.feign.vo.res.ResourceResVO;
import com.alibaba.algo.cooperation.usercomponent.vo.req.user.SelectResourceListByRoleReqVO;
import com.alibaba.algo.cooperation.usercomponent.vo.req.user.UpdateRoleResourceVO;
import com.alibaba.algo.core.base.BaseMapper;
import com.alibaba.algo.dtos.user.SysResourceTreeNodeDTO;
import com.alibaba.algo.entity.user.SysResource;
import com.alibaba.algo.entity.user.SysRoleResource;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 类SysRoleResourceMapper.java的实现描述：角色资源关联Mapper
 *
 * @author nieganggang 2021-03-12 16:08:17
 */
public interface SysRoleResourceMapper extends BaseMapper<SysRoleResource> {

    /**
     * 查询当前角色关联的菜单角色列表
     *
     * @param roleId           角色标识
     * @param resourceTypeList 资源类型列表
     * @return 菜单列表
     */
    List<SysRoleResource> selectMenuResourceListByRoleId(@Param("roleId") Long roleId, @Param("resourceTypeList") List<Integer> resourceTypeList);

    List<SysResource> selectResourceListByRoleId(@Param("roleId") Long roleId);

    int deleteListByRole(UpdateRoleResourceVO vo);

    void batchInsert(@Param("sysRoleResourceList") List<SysRoleResource> sysRoleResourceList);

    List<SysResourceTreeNodeDTO> selectResourceListByRoleIdAndAppCode(@Param("roleId") Long roleId);

    List<SysResourceTreeNodeDTO> selectResourceListByRoleIdListAndAppCode(@Param("obj") SelectResourceListByRoleReqVO vo);

    List<ResourceResVO> selectResourceListByRoleAppPath(@Param("vo") CheckUserPermissionsReqVO vo);
}
